import 'package:flutter/material.dart';

class MyApp15 extends StatelessWidget {
  const MyApp15({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(
          title: const Text('ListView组件builder函数的使用'),
          backgroundColor: Colors.red,
        ),
        body: ListView.separated(
            itemBuilder: (BuildContext context, int index) {
              return Container(
                  child: Padding(
                padding: const EdgeInsets.all(10),
                child: Row(
                  children: [
                    Image.network(
                      'https://yanxuan-item.nosdn.127.net/e529b6ab111ade9da9314867f98d360f.png',
                      width: 90,
                    ),
                    const SizedBox(
                      width: 10,
                    ),
                    const Expanded(
                      child: Text(
                        '海尔（Haier）波轮洗衣机全自动家用 10公斤大容量 直驱变频 一级能效 高效精华洗 以旧换新EB100B37Mate5',
                        maxLines: 2,
                        overflow: TextOverflow.ellipsis,
                      ),
                    ),
                    const Icon(Icons.arrow_right_alt_outlined)
                  ],
                ),
              ));
            },
            //设置列表的分割线
            separatorBuilder: (BuildContext context, int index) {
              return Container(
                padding: const EdgeInsets.all(10),
                child: const Divider(
                  height: 1,
                  color: Color.fromARGB(255, 123, 237, 138),
                ),
              );
            },
            // 列表展示的数量
            itemCount: 20));
  }
}
